<!-- 会签管理>已发送会签单位列表 -->
<template>
  <view>
    <van-empty description="暂无数据" v-if="conSignList.length==0"/>
    <van-list v-model="loading" :finished="finished" @load="load">
      <van-cell center v-for="(item,index) in conSignList" :title="item.huiqianDept" :label="'公文类型：'+item.docType" value-class="text-sm">
        <template #label>
          <view class="padding-top-sm">
            <text class="text-gray text-sm margin-right-sm">接收人:{{item.receiverName}}</text>
            <text class="text-gray text-sm margin-right-sm">当前环节:{{item.taskNow}}</text>
            <text class="text-gray text-sm margin-right-sm">发送人:{{item.senderName}}</text>
          </view>
        </template>
        <template #extra >
          <view class="revoke">
            <view class="text-xs color-blue"><i class="iconfont icon-dian color-blue"/>{{item.state}}</view>
            <van-button v-if="item.state == '会签结束'" class="revoke-btn" type="primary" round  size="small" color="#0079fe"
                        @click="toRecover(index)">恢复</van-button>
            <van-button v-else class="revoke-btn" type="primary" round  size="small" color="#0079fe"
                        @click="toRevoke(index)">撤回</van-button>
          </view>
        </template>
      </van-cell>

    </van-list>
  </view>
</template>

<script>
export default {
  props:{
    conSignList:Array  //流转过程
  },
  data() {
    return {
      newsList: [],
      loading: false,
      finished: true, //不显示加载中
    }
  },
  methods: {
    onReady() {

    },
    load() {

    },
    // 撤回会签
    toRevoke(index){
      this.$dialog.confirm({
        confirmButtonColor: '#1989fa',
        title: '系统提示',
        message: '确定撤回?',
      }).then(() => {//确定按钮
        this.$emit('revokeHuiqian',index)//将当前数组的下标传回父组件，让父组件做撤回操作，然后更新数据
      })
          .catch(() => {
            // on cancel
          });
    },
    //会签恢复
    toRecover(index){
      this.$dialog.confirm({
        confirmButtonColor: '#1989fa',
        title: '系统提示',
        message: '确定恢复?',
      }).then(() => {//确定按钮
        this.$emit('recoverHuiqian',index)//将当前数组的下标传回父组件，让父组件做撤回操作，然后更新数据
      }).catch(() => {

      });
    },
  },

}
</script>

<style scoped>
.color-blue{
  color: #0081ff;
}
.revoke{
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 20%;
}
.revoke-btn{
  margin-top: 20rpx;
  width: 100rpx;
  height: 55rpx;
}
/deep/ .van-cell__title {
  width: 70%;
}
</style>
